package io.github.harmonly.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Apply {

    private int apid;
    private int sender;    // 申请人
    private int receiver;    // 接收人
    /**
     * association - 申请社团
     * activity - 申请活动
     * finance - 申请财务
     */
    private String type;    // 申请类型
    private Date date;  // 申请日期
    /**
     * success - 成功
     * failure - 失败
     * pending - 进行
     */
    private String state;   // 申请状态
    private String content;    // 申请的内容
    private String feedback;    // 失败的建议

    public String transType() {
        switch (type) {
            case "association":
                return "申请社团";
            case "activity":
                return "申请活动";
            case "finance":
                return "申请财务";
            case "member":
                return "加入社团";
            case "association-money":
                return "提交社团会费";
        }
        return "ERROR_TYPE";
    }

    public String transState() {
        if (state.equals("pending")) return "申请中...";
        else if (state.equals("success")) return "申请成功！";
        else return "申请失败！";
    }
}
